<template>
  <div>
    <div class="index-module">
      <div class="flex-vertical">
        <h2>健康宝典</h2>
        <div class="tag">
          <span>权威专家</span>
          <span>权威机构</span>
          <span>三审三校</span>
        </div>
      </div>
      <div class="flex-vertical wrap">
        <div class="look">
          <div class="flex-vertical title">
            <span
              class="iconfont icon-aixin"
              style="color: #f85f69; font-size: 28px"
            ></span>
            <b>大家在看</b>
            <router-link to="/disease">查看更多></router-link>
          </div>
          <div class="rank">
            <div class="item" v-for="(item,index) in dataList" :key="item.id">
              <p class="number">{{index + 1}}</p>
              <p class="name">{{item.diseaseName}}</p>
            </div>
          </div>
        </div>
        <div class="disease">
          <div class="flex-vertical title">
            <span
              class="iconfont icon-yaopin"
              style="color: #36d0ff; font-size: 28px"
            ></span>
            <b>常见疾病</b>
            <router-link to="/disease">查看更多></router-link>
          </div>
          <div class="content">
            <div class="item" v-for="(item,index) in common" :key="item.index">
              <p class="type">{{item.type}}</p>
              <p class="name" v-for="item2 in item.children">{{item2.title}}</p>
            </div>
          </div>
        </div>
        <div class="common"></div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      dataList:{},
      common:[
        {
          type:"儿童疾病",
          children:[
            {
              title:'幼儿急诊',
            },
            {
              title:'小儿鼻炎',
            },
            {
              title:'婴儿感冒',
            },
            {
              title:'手足口病',
            },
            {
              title:'马牙',
            },
            {
              title:'夜惊症',
            },
          ]
        },
        {
          type:"运动损伤",
          children:[
            {
              title:'骨折',
            },
            {
              title:'关节脱位',
            },
            {
              title:'肌腱炎',
            },
            {
              title:'韧带损伤',
            },
            {
              title:'腕管综合征',
            },
            {
              title:'骶骨骨折',
            },
          ]
        },
        {
          type:"皮肤",
          children:[
            {
              title:'多形红斑',
            },
            {
              title:'汗疱疹',
            },
            {
              title:'麻疹',
            },
            {
              title:'皮炎',
            },
            {
              title:'水痘',
            },
            {
              title:'痱子',
            },
          ]
        },
        {
          type:"消化内科",
          children:[
            {
              title:'肠炎',
            },
            {
              title:'慢性腹泻',
            },
            {
              title:'消化不良',
            },
            {
              title:'脂肪肝',
            },
            {
              title:'结肠炎',
            },
            {
              title:'慢性胃炎',
            },
          ]
        },
        {
          type:"传染病",
          children:[
            {
              title:'疟疾',
            },
            {
              title:'天花',
            },
            {
              title:'伤寒',
            },
            {
              title:'登革热',
            },
            {
              title:'风疹',
            },
            {
              title:'衣原体感染',
            },
          ]
        }
      ]
    };
  },
  created(){
    this.getDataList()
  },
  methods:{
    getDataList(){
      this.HttpService.getDiseaseMostPV().then(res =>{
        console.log(res)
        this.dataList = res.data
      })
    }
  }
};
</script>

<style lang='less' scoped>
.tag {
  margin-left: 25px;
  span {
    margin-right: 15px;
    color: #858585;
  }
}
.wrap {
  display: flex;
  justify-content: space-around;
  margin-top: 10px;
}
.look {
  position: relative;
  background-color: #fff;
  border-radius: 15px;
  height: 250px;
  width: 33%;
  .title {
    background-image: linear-gradient(#ffefee, #fff);
    line-height: 30px;
    font-size: 18px;
    padding: 10px;
    a {
      position: absolute;
      right: 10px;
      font-size: 14px;
      color: #000;
    }
  }
  .rank {
    height: 200px;
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    .item {
      display: flex;
      height: 40px;
      align-items: center;
      margin-left: 20px;
      .number{
        width: 18px;
        height: 18px;
        line-height: 18px;
        border-radius: 3px;
        text-align: center;
        background-color: #cccccc;
        color:#fff;
      }
      .name{
        margin-left: 8px;
      }
    }
    .item:nth-child(1){
      .number{
        background-color: #fd503e;
      }
    }
    .item:nth-child(2){
      .number{
        background-color: #ff6600;
      }
    }
    .item:nth-child(3){
      .number{
        background-color: #f3a943;
      }
    }
  }
}
.disease {
  position: relative;
  width: 65%;
  height: 250px;
  background-color: #fff;
  border-radius: 15px;
  .title {
    background-image: linear-gradient(#e6fafa, #fff);
    line-height: 30px;
    font-size: 18px;
    padding: 10px;
    a {
      position: absolute;
      right: 10px;
      font-size: 14px;
      color: #000;
    }
  }
  .content{
    .item{
      display: flex;
      line-height: 32px;
      margin-bottom: 8px;
      p{
        width: 100px;
        text-align: center;
      }
      .type{
        font-weight: bold;
        border-right: 1px solid #eee;
      }
    }
  }
}
</style>
